﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CarsWebApplication.businesslogic.constants;

namespace CarsWebApplication.businesslogic.entities
{
    /// <summary>
    /// Summary description for Offer
    /// </summary>
    public class Offer
    {
        string brand;
        string model;
        int year;
        double price;
        string contact;

        public Offer(string commaSeparatedValue)
        {
            if (string.IsNullOrEmpty(commaSeparatedValue) == false)
            {
                string[] offerInfo = commaSeparatedValue.Split(CarWebAppConstants.COMMA);
                this.brand = offerInfo[0];
                this.model = offerInfo[1];
                Int32.TryParse(offerInfo[2], out this.year);
                Double.TryParse(offerInfo[3], out this.price);
                this.contact = offerInfo[4];
            }
        }

        public string Brand
        {
            get { return brand; }
            set { brand = value; }
        }

        public string Model
        {
            get { return model; }
            set { model = value; }
        }

        public int Year
        {
            get { return year; }
            set { year = value; }
        }

        public double Price
        {
            get { return price; }
            set { price = value; }
        }

        public string Contact
        {
            get { return contact; }
            set { contact = value; }
        }
    }
}